# coding=utf-8
"""
Created on 17/11/2013

@author: root
"""

class Breadcrumb(object):
    def __init__(self, description, slug, bread):
        self.description = description
        self.slug = slug
        self.bread = bread

    def __str__(self):
        return self.description + "-" + self.slug


class MapperUrl(object):
    def createUrlFilter(self, key, dictionaryFilter):
        filters = ['tags', 'cat', 'zones.desc', 'szones.desc', 'date']
        url_suffix = ''
        for selected in dictionaryFilter.keys():
            filters.remove(selected)
            if selected == 'tags':
                url_suffix += selected + '_' + '-'.join(dictionaryFilter[selected]['$all']) + "__"
            else:
                url_suffix += selected + '_' + dictionaryFilter[selected] + "__"
        result = key + '_<value>__' + url_suffix
        return result[:-2]
             
if __name__ == '__main__':
    results=MapperUrl().createUrlFilter('zones.desc',{u'cat': u'cientificoinvestigacion',u'tags': u'java'})
    print results



